package com.sunxu.main;

import com.alibaba.fastjson.JSON;
import com.sunxu.dao.StudentDao;
import com.sunxu.dao.StudentSelfCardDao;
import com.sunxu.po.Role;
import com.sunxu.dao.RoleDao;
import com.sunxu.po.RoleParam;
import com.sunxu.po.Student;
import com.sunxu.utils.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.List;

/**
 * @author 孙许
 * @date 2018-07-10
 * @description
 */
public class Client {
    private static Logger logger = LogManager.getLogger(Client.class.getName());
    public static void main(String[] args) {
        SqlSession sqlSession = null;

        try {
            sqlSession = SqlSessionFactoryUtil.getSqlSessionFactory().openSession();
            StudentDao mapper = sqlSession.getMapper(StudentDao.class);
            Student student = mapper.getStudent(711001);
            String s = JSON.toJSONString(student);
            System.out.println(s);
//            StudentSelfCardDao mapper = sqlSession.getMapper(StudentSelfCardDao.class);
//            System.out.println(mapper.findStudentSelfcardByStudentId(711001));

        } finally {
            sqlSession.close();
        }
        logger.info("执行成功");
    }
}
